<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录页面</title>
<script src="../js/jquery/jquery-3.3.1.slim.js"></script>
<script type="text/javascript">
	//尝试执行JQ代码
	$(function() {
		$("#login").click(function () {
			//LoginFunc();				//可以直接调用JS函数
			$("#servlet_form").post("Login",)
		});
		
		$("#servlet_form").submit(function () {
			alert("提交提交提交啦啦啦啦啦");
		})
	});

	function LoginFunc() {
		console.log("login");
		var form = document.getElementById("servlet_form");
		var inputUserName = document.getElementById("user_name");
		var inputUserPwd = document.getElementById("user_pwd");
		console.log(inputUserName);
		console.log(inputUserPwd);
		
		if(inputUserName.value==""){
			alert("账号不能为空");
			return;
		}
		
		if(inputUserPwd.value==""){
			alert("密码不能为空");
			return;
		}
		
		form.action="Login";
		form.method="post";
		form.submit(); 
		alert("Login");
	}
	
	function PramsFunc() {
		console.log("params");
		var form = document.getElementById("servlet_form");
		form.action="Params";
		form.method="get";
		form.submit(); 
	}
</script>
</head>

<body>
	<form id="servlet_form" action="">
		账号：<input type="text" id="user_name" name="user_name" style="border: 1px solid #faaafe"/>
		<br/>
		密码：<input type="password" id="user_pwd" name="user_pwd" style="border: 1px solid #abcdef"/>
		<br/>
		<input type="button" id="login" value="登陆" style="background: #eeeeee" />
		<br/>
		<input type="button" id="params" value="Servlet测试" style="background: #eeeeee" onclick="PramsFunc()"/>
	</form>
</body>
</html>